package com.sitc.administrator.application.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.sitc.administrator.application.R;
import com.sitc.administrator.application.domain.Conversation;
import com.sitc.administrator.application.util.ImageUtil;
import com.sitc.administrator.application.util.TimeUtil;


public class ConversationAdapter extends BaseQuickRecyclerViewAdapter<Conversation> {


    //private String userId;

    public ConversationAdapter(Context context, int layoutId) {
        super(context, layoutId);

    }

    @Override
    protected void bindData(final ViewHolder holder, int position, final Conversation data) {

        ImageView iv_avatar= (ImageView) holder.findViewById(R.id.iv_avatar);

        ImageUtil.showCircle(context, iv_avatar, R.drawable.ic_ok);
        holder.setText(R.id.tv_nickname,"xuzheng");
        holder.setText(R.id.tv_info, "今天星期几");
        holder.setText(R.id.tv_time, TimeUtil.toLocalDate(0));

        int unreadMessageCount = 100;
        if (unreadMessageCount > 0) {
            if (unreadMessageCount > 99) {
                //显示99+
                holder.setText(R.id.tv_count, "99+");
            } else {
                holder.setText(R.id.tv_count, String.valueOf(unreadMessageCount));
            }

            holder.setVisibility(R.id.tv_count, View.VISIBLE);
        } else {
            holder.setVisibility(R.id.tv_count, View.GONE);
        }







    }

}
